package com.pocketsweet.model;

import java.util.Date;

import com.avos.avoscloud.AVClassName;
import com.avos.avoscloud.AVFile;
import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVRelation;

@AVClassName("MLArticle")
public class MLArticle extends AVObject {
	public static String STATUS = "status";// 文章状态
	public static String TYPE = "type";// 文章所属类型
	public static String TITLE = "title";// 标题
	public static String ADDRESS = "address";// 网址
	public static String TITLE_IMG = "title_img";// 标题图片
	public static String INTRO = "intro";// 文章简介
	public static String TOPIC = "topic";// 文章所述专题
	public static String AUTHOR = "author";// 文章作者
	public static String LIKECOUNT = "likeCount";// 文章被赞次数
	public static String SHARECOUNT = "shareCount";// 文章被分享次数
	public static String COMMENTCOUNT = "commentCount";// 文章被评论次数
	public static String READCOUNT = "readCount";//文章被阅读次数

	public static String PUBLISHTIME = "publishTime";// 文章发布时间

	public MLArticle() {
		setLikeCount(0);
		setShareCount(0);
		setCommentCount(0);
	}

	public Date getPublishTime() {
		return super.getDate(PUBLISHTIME);
	}

	// 文章状态
	public int getStatus() {
		return super.getInt(STATUS);
	}

	public void setStatus(int value) {
		super.put(STATUS, value);
	}

	// 文章类型
	public int getType() {
		return super.getInt(TYPE);
	}

	public void setType(int value) {
		super.put(TYPE, value);
	}

	// 文章标题
	public String getTitle() {
		return super.getString(TITLE);
	}

	public void setTitle(String value) {
		super.put(TITLE, value);
	}

	// address
	public String getAddress() {
		return super.getString(ADDRESS);
	}

	public void setAddress(String value) {
		super.put(ADDRESS, value);
	}

	// 文章标题图片
	public AVFile getTitleImg() {
		return super.getAVFile(TITLE_IMG);
	}

	public String getTitleImgUrl() {
		AVFile titleImg = getTitleImg();
		if (titleImg != null) {
			return titleImg.getUrl();
		} else {
			return null;
		}
	}

	public void setTitleImg(AVFile value) {
		super.put(TITLE_IMG, value);
	}

	// 文章简介
	public String getIntro() {
		return super.getString(INTRO);
	}

	public void setIntro(String value) {
		super.put(INTRO, value);
	}

	// 文章所述专题（外键1:1）
	public MLTopic getTopic() {
		return (MLTopic) super.getAVObject(TOPIC);
	}

	public void setTopic(MLTopic value) {
		super.put(TOPIC, value);
	}

	// 文章作者
	public String getAuthor() {
		return super.getString(AUTHOR);
	}

	public void setAuthor(String value) {
		super.put(AUTHOR, value);
	}

	// 用户赞的次数
	public int getLikeCount() {
		return super.getInt(LIKECOUNT);
	}

	public void setLikeCount(int value) {
		super.put(LIKECOUNT, value);
	}

	// 用户分享的次数
	public int getShareCount() {
		return super.getInt(SHARECOUNT);
	}

	public void setShareCount(int value) {
		super.put(SHARECOUNT, value);
	}

	// 用户评论的次数
	public int getCommentCount() {
		return super.getInt(COMMENTCOUNT);
	}

	public void setCommentCount(int value) {
		super.put(COMMENTCOUNT, value);
	}

	// 用户阅读的次数
	public int getReadCount() {
		return super.getInt(READCOUNT);
	}

	public void setReadCount(int value) {
		super.put(READCOUNT, value);
	}

}
